//
//  DescribeView.m
//  LearnObjectiveC
//
//  Created by 吴可高 on 16/6/13.
//  Copyright © 2016年 吴可高. All rights reserved.
//

#import "DescribeView.h"
@class DescribeContentView;
@protocol DescribeContentViewDelegate<NSObject>


-(void)changedDescribeContent:(DescribeContentView*)contentView withAttribute:(CGRect)attribute;
@end

@interface DescribeContentView : UIView

@property (weak, nonatomic) id <DescribeContentViewDelegate>  delegate;
@end

@implementation DescribeContentView

- (instancetype)initWithCoder:(NSCoder *)coder
{
    self = [super initWithCoder:coder];
    if (self) {
        [self setUp];
    }
    return self;
}
- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        [self setUp];
    }
    return self;
}
-(void)setUp
{
   
    

}
-(void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event
{
 
}

-(void)layoutSubviews
{
    [super layoutSubviews];
    
    NSLog(@"describeContentView layoutSubviews  ********************\n\n");
    if (_delegate && [_delegate respondsToSelector:@selector(changedDescribeContent:withAttribute:)]) {
        [_delegate changedDescribeContent:self withAttribute:self.frame];
        NSLog(@"\n\n  _delegate changedDescribeContent");
    }
}
@end

@interface DescribeView()<DescribeContentViewDelegate>
{
    NSMutableArray * _labels;
}
@property (strong, nonatomic) DescribeContentView * descContentView;

@end
@implementation DescribeView

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        _labels = [NSMutableArray array];
        [self setUp];
    }
    return self;
}

- (instancetype)initWithCoder:(NSCoder *)coder
{
    self = [super initWithCoder:coder];
    if (self) {
        _labels = [NSMutableArray array];
        [self setUp];
    }
    return self;
}

#pragma mark Initialize View Style
-(void)setUp
{
     self.backgroundColor = [UIColor whiteColor];
    [self addSubview:self.descContentView];
    [self.descContentView mas_makeConstraints:^(MASConstraintMaker *make) {
        UIEdgeInsets insets = UIEdgeInsetsMake(0, 0,    0, 0);
        make.edges.mas_equalTo(self).with.insets(insets);
    }];
}
#pragma mark View Algorithm Processor

#pragma mark Setter Method View Style
#pragma mark Getter Method View Style
- (DescribeContentView *)descContentView
{
    _descContentView = ({
        if (!_descContentView) {
            _descContentView  = [DescribeContentView new];
        }
        _descContentView.delegate = self;
        _descContentView;
    });
    return _descContentView;
}
#pragma mark IBOutlet Action View
#pragma mark Possess  Delegate View（委托代理者）
-(void)changedDescribeContent:(DescribeContentView *)contentView withAttribute:(CGRect)attribute
{
  
}

#pragma mark Other Method
-(void)layoutSubviews
{
    [super layoutSubviews];
}

@end
